<!DOCTYPE html>
<html>
{include file="public/head"}

<body>
    {include file="public/nav"} {include file="public/nav-2"}
    <div class="layui-container">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md9">
                <div class="fly-panel-title" style="text-align: center;">
                    <form action="" method="get" class="layui-form">
                        <div class="layui-input-inline status-input-comb">
                            <div class="layui-form-item">
                                <input type="text" name="keyword" placeholder="按题目ID或标题搜索" class="layui-input" value="{$keyword}" />
                            </div>
                        </div>
                        <div class="layui-input-inline">
                            <div class="layui-form-item">
                                <button type="submit" class="layui-btn">开始搜索</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="top:7px">
                            <div class="layui-form-item">
                                <span id="high-search">
                                <i class="layui-icon" style="font-size: 30px; color: #1E9FFF; cursor: pointer;" title="高级搜索">&#xe608;</i> 
                            </span>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="bottom:3px">
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="font-size: 20px;top:11px;">分类</label>
                                <script>
                                    if(localStorage.getItem("switchtag")=="true") {
                                        document.write("<input type=\"checkbox\" name=\"switch\" lay-skin=\"switch\" lay-filter=\"tag\" checked>");
                                    }
                                    else {
                                        document.write("<input type=\"checkbox\" name=\"switch\" lay-skin=\"switch\" lay-filter=\"tag\">");
                                    }
                                </script>
                                
                            </div>
                        </div>
                    </form>
                </div>
                <div style="text-align: center;">
                    {$page}
                </div>
                <div class="fly-panel" style="margin-bottom: 0;">
                    <table class="layui-table" lay-even lay-skin="nob">
                        <colgroup>
                            <col width="60">
                            <col width="60">
                            <col width="60">
                            <col width="250">
                            <col>
                            <col width="150">
                        </colgroup>
                        <thead>
                            <tr class="layui-bg-black"  style="text-align: center;">
                                <th>通过</th>
                                <th>题号</th>
                                <th  style="text-align: center;">难度</th>
                                <th  style="text-align: center;">标题</th>
                                <th style="text-align: center">分类</th>
                                <th style="text-align: center">通过率</th>
                            </tr>
                        </thead>
                        <tbody class="problem-list">
                            {foreach name="list" item="v" key="k"} {if condition="($v.defunct=='N'||$power==true)"}
                            <tr style="text-align: center">
                                <td >
                                    {if condition="($v.defunct=='Y'&&$power==true)"}
                                    <button class="layui-btn layui-btn-xs layui-btn-normal show_problem" id="{$v.problem_id}">显示</button>
                                    {/if} {eq name="v.result" value="0"}<i class="layui-icon" style="font-size: 25px; color: #5FB878;">&#xe618;</i> {/eq} {eq name="v.result" value="1"}<i class="layui-icon" style="font-size: 25px; color: #FF5722;">&#xe69c;</i> {/eq}
                                </td>
                                <td  >
                                    {$v.problem_id}
                                </td>
                                <td >
                                    {$v.score}
                                </td>
                                <td  style="text-align: center;">
                                    <h3>
                                            <a href="{:url('web/Problem/problem','pid='.$v['problem_id'])}" class="fly-link fly-joinad">{$v.title}</a>
                                        </h3>
                                </td>
                                <td>
                                    <div class="display_tag" style="text-align: center ;visibility: hidden;">
                                        {if condition="isset($tag_lists[$v.problem_id])"} {volist name="tag_lists[$v.problem_id]" id="vo" key="kk" empty=""}
                                        <a href="{:url('web/classify/index',['tid'=>$vo.tag_id])}" class="layui-badge layui-bg-blue">{$vo.tag_name}</a> {/volist} {/if}
                                    </div>
                                </td>
                                <td style='text-align: center;'>
                                    {if condition="$v.accepted==0"} 0% {else /} {:number_format($v.accepted/$v.submit*100, 0)}% {/if} &nbsp;({$v.accepted}/{$v.submit})
                                    <!--                                    <span > 
                                        提交数:{$v.submit}
                                    </span>
                                    <span > 
                                        通过数:{$v.accepted}
                                    </span>-->
                                    <!-- <span style="float:right"> 
                                            来源:{$v.source}
                                        </span> -->
                                </td>
                            </tr>
                            {/if} {/foreach}
                        </tbody>
                    </table>
                </div>
                <div style="text-align: center;">
                    {$page}
                </div>
            </div>
            {include file="public/problemset-side"}
        </div>
    </div>
    {include file="public/foot"}
</body>
<script>
layui.use(['table', 'form', 'jquery'], function() {
    var table = layui.table;
    var form = layui.form;
    var $ = layui.jquery;

    if (localStorage.getItem("switchtag")=="true"){
        $(".display_tag").css("visibility", "visible");
    }
    form.on('switch(tag)', function(data) {
        if(localStorage.getItem("switchtag")==undefined){
            localStorage.setItem("switchtag","true");
        }

        if (localStorage.getItem("switchtag")=="true") {
            $(".display_tag").css("visibility", "hidden");
            localStorage.setItem("switchtag","false");
        } else {
            $(".display_tag").css("visibility", "visible");
            localStorage.setItem("switchtag","true");
        }
    });
    $('.show_problem').click(function(){
        var pid = $(this).attr('id');
        var jq = $(this);
        $.ajax({
            url:"/admin/api/setstatus/"+pid,
            success:function(res) {
                if(res.code==0)  {
                    layer.msg(res.msg);
                    jq.hide();
                } else {
                    layer.msg(res.msg);
                }

            }
        });
    });
    $('#high-search').click(function(){
        layer.open({
            type:1,
            title:'高级搜索',

            content:['<div class="fly-panel fly-panel-user" style="padding-left:20px;padding-right: 20px;">',
'            <div class="layui-tab layui-tab-brief" lay-filter="user">',
'                <ul class="layui-tab-title">',
'                    <li class="layui-this">搜索</li>',
'                </ul>',
'                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">',
'                    <div class="layui-tab-item layui-show">',
'                        <div class="layui-form layui-form-pane">',
'                            <form method="get" id="myform" action="{:url('web/problem/searchproblem')}">',
'                                <div class="layui-form-item">',
'                                    <label for="L_email" class="layui-form-label">题号</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="pid" class="layui-input">',
'                                    </div>',
'                                </div>',
'                                <div class="layui-form-item">',
'                                    <label for="L_title" class="layui-form-label">标题</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="title" class="layui-input">',
'                                    </div>',
'                                </div>',
'                                <div class="layui-form-item">',
'                                    <label for="L_content" class="layui-form-label">内容</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="content" class="layui-input">',
'                                    </div>',
'                                </div>',
'                                <div class="layui-form-item">',
'                                    <label for="L_source" class="layui-form-label">来源</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="source" class="layui-input">',
'                                    </div>',
'                                </div>',




'                                <div class="layui-form-item">',
'                                    <label for="L_min_score" class="layui-form-label">最小难度</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="min_score" class="layui-input">',
'                                    </div>',
'                                </div>',
'                                <div class="layui-form-item">',
'                                    <label for="L_max_score" class="layui-form-label">最大难度</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="max_score" class="layui-input">',
'                                    </div>',
'                                </div>',






'                                <div class="layui-form-item">',
'                                    <label for="L_min_ac" class="layui-form-label">最小通过数</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="min_ac" class="layui-input">',
'                                    </div>',
'                                </div>',
'                                <div class="layui-form-item">',
'                                    <label for="L_max_ac" class="layui-form-label">最大通过数</label>',
'                                    <div class="layui-input-inline">',
'                                        <input type="text" name="max_ac" class="layui-input">',
'                                    </div>',
'                                </div>',


'                                <div class="layui-form-item"  style="margin-left: 235px"> ',
'                                    <button class="layui-btn" lay-filter="search" lay-submit>搜索</button>',
'                                </div>',
'                            </form>',
'                        </div>',
'                    </div>',
'                </div>',
'            </div>',
'       </div>'].join(""),
            shadeClose:true,
            area:['450px','auto'],
            anim: 0,
            scrollbar:true
        });
        form.render();
    });
});
</script>

</html> 
